package archer.framework.file.entity;


import archer.framework.utils.JSONUtils;

/**
 * 元数据
 *
 * @author christ
 * @date 2015/9/24
 */
public class Metadata {

    /**
     * 媒体类型
     */
    private String mimeType = "";

    /**
     * 文件名
     */
    private String filename = "";

    /**
     * 路径
     */
    private String path = "";

    /**
     * 文件id
     */
    private String id = "";

    /**
     * 大小
     */
    private long size;

    private String status = "CREATED";

    public Metadata(String filename, String mimeType) {
        this.filename = filename;
        this.mimeType = mimeType;
    }

    public Metadata() {
    }

    public String getMimeType() {
        return mimeType;
    }

    public Metadata setMimeType(String mimeType) {
        this.mimeType = mimeType;
        return this;
    }

    public String getFilename() {
        return filename;
    }

    public Metadata setFilename(String filename) {
        this.filename = filename;
        return this;
    }

    public String getPath() {
        return path;
    }

    public Metadata setPath(String path) {
        this.path = path;
        return this;
    }

    public String getId() {
        return id;
    }

    public Metadata setId(String id) {
        this.id = id;
        return this;
    }

    public long getSize() {
        return size;
    }

    public Metadata setSize(long size) {
        this.size = size;
        return this;
    }

    public String getStatus() {
        return status;
    }

    public Metadata setStatus(String status) {
        this.status = status;
        return this;
    }

    @Override
    public String toString() {
        return JSONUtils.serialize(this, "*");
    }

    public Metadata load(String json) {
        return JSONUtils.deserialize(json, Metadata.class);
    }
}
